package com.itheima.controller;


import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.entity.QueryPageBean;
import com.itheima.entity.Result;
import com.itheima.pojo.Member;

import com.itheima.service.MemberService;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/member")
public class MemberController {


    @Reference(version = "1.0.0")
    private MemberService memberService;


    @PostMapping("findPage")
    public Result findPage(@RequestBody QueryPageBean queryPageBean){
        System.out.println(memberService.findPage(queryPageBean));
        return memberService.findPage(queryPageBean);
    }

    @PostMapping("add")
    public Result add(@RequestBody Member member) {
        System.out.println(member);
        System.out.println(memberService.add(member));
        return memberService.add(member);
    }

  @PostMapping("update")
    public Result update(@RequestBody Member member){
      System.out.println(member);
      System.out.println(memberService.update(member));
        return memberService.update(member);
  }
  @GetMapping("findAll")
    public Result findAll(){
      System.out.println(memberService.findAll());
        return memberService.findAll();
  }

  @GetMapping("findById")
    public Result findById(Integer id){
      System.out.println(id);
      System.out.println(memberService.findById(id));
        return memberService.findById(id);
  }
  @GetMapping("delete")
    public Result delete(Integer id){
        return memberService.delete(id);
  }

}


